% -------------------------------------------------------------------------
% 平面双圆限制性四体问题动力学模型
%
% Copyright(C) 2015/04/29 by Chen Zhang, 
% School of Astronautics, Beihang University
% chenzhang.buaa@gmail.com
% -------------------------------------------------------------------------
function [dxx] = f4y(t , xx , auxdata)
mu = auxdata.mu;
ms = auxdata.ms;
rho = auxdata.rho;
ws = auxdata.ws;
theta = ws * t;
x = xx(1); y = xx(2); vx = xx(3); vy = xx(4);
r1cube = ((x + mu)^2 + y^2)^(3/2) ;
r2cube = ((x + mu - 1)^2 + y^2)^(3/2) ;
r3cube = ((x - rho * cos(theta))^2 + (y - rho * sin(theta))^2)^(3/2);
sunperb_x = -ms * (x - rho * cos(theta)) / r3cube - ms * cos(theta) / rho^2;
sunperb_y = -ms * (y - rho * sin(theta)) / r3cube - ms * sin(theta) / rho^2;
dxx = [vx ;
    vy ;
    2*vy + x - (1-mu)*(x+mu)/r1cube - mu*(x+mu-1)/r2cube + sunperb_x;
    -2*vx + y - (1-mu)*y/r1cube - mu*y/r2cube + sunperb_y] ;
end
